<template>
  <div class="banner">
    <div class="banner-background"></div>
    <div class="banner-image-container">
      <img src="../../gallery/Background image.png" alt="教育背景" class="banner-image" />
    </div>
    <div class="banner-content">
              <h2 class="banner-title">代码小英雄 - 助力孩子编程成长</h2>
      <p class="banner-desc">8-16岁青少年编程学习平台</p>
      <div class="banner-btns">
        <a href="#" class="btn btn-primary">免费体验</a>
        <a href="#" class="btn btn-outline">了解更多</a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomeBanner'
}
</script>

<style scoped>
.banner {
  position: relative;
  color: white;
  min-height: 650px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  background-color: #2d4b43;
}

.banner-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.banner-image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.banner-image {
  min-width: 100%;
  min-height: 100%;
  object-fit: cover; /* 使用cover填充整个区域 */
  position: absolute;
}

@media (min-width: 1200px) {
  .banner-image {
    object-fit: contain; /* 在大屏幕上使用contain确保完整显示 */
    min-width: auto;
    min-height: auto;
    max-height: 100%;
    max-width: 100%;
  }
}

.banner-content {
  position: absolute;
  max-width: 600px;
  z-index: 1;
  text-align: right;
  /* 调整内容位置到右下角，避开人物 */
  right: 5%;
  bottom: 15%;
  background-color: transparent; /* 移除背景色 */
  padding: 20px;
}

.banner-title {
  font-size: 2.5rem;
  margin-bottom: 16px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); /* 增强文字阴影使文字更清晰 */
}

.banner-desc {
  font-size: 1.25rem;
  margin-bottom: 32px;
  opacity: 0.9;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); /* 增强文字阴影 */
}

.banner-btns {
  display: flex;
  justify-content: flex-end; /* 按钮右对齐 */
  gap: 16px;
}

.btn {
  padding: 12px 25px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* 添加按钮阴影 */
}

.btn-primary {
  background-color: #ff7b00;
  color: white;
  border: none;
}

.btn-primary:hover {
  background-color: #e66e00;
  transform: translateY(-2px);
}

.btn-outline {
  border: 2px solid white;
  color: white;
  background-color: rgba(255, 255, 255, 0.1); /* 轻微透明背景 */
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-test {
  background-color: #28a745;
  color: white;
  border: none;
}

.btn-test:hover {
  background-color: #218838;
  transform: translateY(-2px);
}

/* 移动设备适配 */
@media (max-width: 768px) {
  .banner {
    min-height: 500px;
    height: 80vh;
  }
  
  .banner-content {
    right: 5%;
    bottom: 10%;
    max-width: 400px;
  }
  
  .banner-btns {
    justify-content: center;
  }
  
  .banner-title {
    font-size: 2rem;
  }
  
  .banner-desc {
    font-size: 1.1rem;
    margin-bottom: 20px;
  }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
  .banner-content {
    right: 5%;
    bottom: 5%;
    max-width: 90%;
  }
}
</style> 